<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="css/add.css"/>
    <script type="text/javascript" src="js/jquery.1.9.1.js" ></script>
    <script type="text/javascript" src="js/layer.js" ></script>
    <link rel="stylesheet" type="text/css" href="css/layer.css"/>
    <script type="text/javascript" src="js/rem.js" ></script>
    <title>新增计划</title>
</head>
<body>
<form id="form2" action="" enctype="multipart/form-data"  method="post">
<ul class="order_money">
    <li style="height: 1.5rem;">
    		<span class="zhou">开会周次</span>
    		<span style="color: #f83535;">*</span>
    		<select id="year">
    			<option value="0">请选择年份</option>
    		</select>
    		<select id="week">
    			<option value="0">请选择周次</option>
    		</select>
    </li>
    <li>
    		<span class="changci">开会场次</span>
    		<span style="color: #f83535;">*</span>
    		<select class="session">
    			<option value="0">请选择</option>
    			<option value="1">1场</option>
    			<option value="2">2场</option>
    			<option value="3">3场</option>
    			<option value="4">4场</option>
    			<option value="5">5场</option>
    			<option value="6">6场</option>
    		</select>
    </li>
    <li>
    		<span class="changdi">开会场地</span>
    		<span style="color: #f83535;float: left;margin-left: 0.1rem;">*</span>
    		<input class="address" type="text" name="" id="" value="" placeholder="请输入开会场地" />
    </li>
</ul>
<ul class="beizhu">
	<li>
		<p class="title">备注<span style="color: #f83535;">*</span></p>
        <textarea name="" value="" placeholder="请输入备注信息" ></textarea>
    </li>
</ul>
<div class="button">
		<a href="#"><div class="close">保存草稿</div></a>
		<div class="continue"><input class="pay" type="submit" name="" id="" value="提交审批" /></div>
</div>

</form>
<script>
$(function(){
	$('.pay').click(function(){
		var week = $('#week').val();
		var session = $('.session').val();
		var address = $('.address').val();
		var txt = $('textarea').val();
		if(week == 0){
				layer.open({
				content:'请选择开会周次' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(session == 0){
				layer.open({
				content:'请选择开会场次' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(address == ''||address == null){
				layer.open({
				content:'请输入开会场次' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(txt == ''||txt == null){
				layer.open({
				content:'请输入备注' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		$.ajax({
		  type: 'post',
		  url:"" ,
		  data:{week:week,session:session,address:address,txt:txt},
		  dataType: "json",
		  success: function(data){
		    window.location.href = "";
		      }
		 });
	  });
	//字体变化
	$('#week').change(function(){
		var week = $('#week').val();
		if(week != 0){
			$('.zhou').css('font-size','0.2rem');
		}else{
			$('.zhou').css('font-size','0.28rem');
		}
	});
	$('.queding').click(function(){
		var week = $('#week').val();
		if(week != ''){
			$('.zhou').css('font-size','0.2rem');
		}else{
			$('.zhou').css('font-size','0.28rem');
		}
	});
	$('.session').change(function(){
		var session = $('.session').val();
		if(session != 0){
			$('.changci').css('font-size','0.2rem');
		}else{
			$('.changci').css('font-size','0.28rem');
		}
	});
	$('.address').keyup(function(){
		var address = $('.address').val();
		if(address != ''){
			$('.changdi').css('font-size','0.2rem');
		}else{
			$('.changdi').css('font-size','0.28rem');
		}
	});
	$('textarea').keyup(function(){
		var textarea = $('textarea').val();
		if(textarea != ''){
			$('.title').css('font-size','0.2rem');
		}else{
			$('.title').css('font-size','0.28rem');
		}
	});
});
	  
</script>
<script>//选择周次
$.ajax({
  url: 'https://oa.fc62.com/api/ajax/year?num=5',
  type: 'get',
  success: function (year) {
  	if($('#year option').length<2){
  		$.each(year.data,function (index,value) {
//		    		console.log(value);
			$('#year').append('<option value="'+value.value+'">'+value.name+'</option>');
	   });
  	}
  }
});	
$('#year').change(function(){
	$('#week').empty();
	$('#week').append('<option value="0">请选择周次</option>');
	var myyear = $("#year").find("option:selected").val();
	$.get('https://oa.fc62.com/api/ajax/year?year='+myyear,function (week) {
		if($('#week option').length<2){
			$.each(week.data,function (index,value) {
				$('#week').append('<option value="'+value.value+'">'+value.name+'</option>');
		   });
		}
	});
});
</script>
</body>
</html>
